package com.chat.io;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
/*
  将二进制数组转换成文件的工具类
 */
public class SetFile {
       public File set(byte[] data,String filename){
           File file=null;
           try {
                file=new File("D:/chatproject/client/"+filename+"");
               FileOutputStream fos=new FileOutputStream(file);
               fos.write(data,0,data.length);
               System.out.println("加载文件");
               System.out.println(fos.toString());
               fos.close();
           } catch (IOException e) {
               e.printStackTrace();
           }
           return file;
       }
}
